package cz.muni.fi.pa165.sme.services.converter;

import cz.muni.fi.pa165.sme.api.to.SportActivityTO;
import cz.muni.fi.pa165.sme.dao.entity.SportActivity;
import org.springframework.core.convert.converter.Converter;

/**
 * @author Martin Novak
 */
public class SportActivityTO2SportActivityConverter implements Converter<SportActivityTO, SportActivity> {
	@Override
	public SportActivity convert(final SportActivityTO source) {
		if(source == null) {
			return null;
		}

		final SportActivity target = new SportActivity();
                target.setId(source.getId());
                target.setSpeed(source.getSpeed());
                target.setTitle(source.getTitle());
                
                return target;
	}
}
